package org.jetnuke.entities;

import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;

public class CalendarEvent implements Comparable{
	private int iD;
	private int uID;
	private String tITLE ;
	private String  fULLDESC;
	private int tYPE;
	private Date  sTART_DATE;
	private Date  sTART_TIME;
	private Date dURATION;
	private String lOCATION;
	private int rECURRING;
	private int fREQ;
	private int wF;
	private int wD;
	private int wX;
	private Date eXPIRATION;
	public int getStartHour(){
		if(sTART_TIME==null)
			return -1;
		GregorianCalendar gc=new GregorianCalendar();
		gc.setTime(sTART_TIME);
		return  gc.get(Calendar.HOUR_OF_DAY);
	}
	public int getMonth(){
		GregorianCalendar gc=new GregorianCalendar();
		gc.setTime(sTART_DATE);
		return gc.get(Calendar.MONTH);
	}
	public int getExpirationMonth(){
		if(eXPIRATION==null)
			return -1;
		GregorianCalendar gc=new GregorianCalendar();
		gc.setTime(eXPIRATION);
		return gc.get(Calendar.MONTH);
	}
	public int getYear(){
		GregorianCalendar gc=new GregorianCalendar();
		gc.setTime(sTART_DATE);
		return gc.get(Calendar.YEAR);
	}
	public int getExpirationYear(){
		if(eXPIRATION==null)
			return -1;
		GregorianCalendar gc=new GregorianCalendar();
		gc.setTime(eXPIRATION);
		return gc.get(Calendar.YEAR);
	}
	public int getDate(){
		GregorianCalendar gc=new GregorianCalendar();
		gc.setTime(sTART_DATE);
		return gc.get(Calendar.DAY_OF_MONTH);
	}
	public int getExpirationDate(){
		if(eXPIRATION==null)
			return -1;
		GregorianCalendar gc=new GregorianCalendar();
		gc.setTime(eXPIRATION);
		return gc.get(Calendar.DAY_OF_MONTH);
	}
	public Date getDURATION() {
		return dURATION;
	}
	public void setDURATION(Date duration) {
		dURATION = duration;
	}
	public Date getEXPIRATION() {
		return eXPIRATION;
	}
	public void setEXPIRATION(Date expiration) {
		eXPIRATION = expiration;
	}
	public int getFREQ() {
		return fREQ;
	}
	public void setFREQ(int freq) {
		fREQ = freq;
	}
	public String getFULLDESC() {
		return fULLDESC;
	}
	public void setFULLDESC(String fulldesc) {
		fULLDESC = fulldesc;
	}
	public int getID() {
		return iD;
	}
	public void setID(int id) {
		iD = id;
	}
	public String getLOCATION() {
		return lOCATION;
	}
	public void setLOCATION(String location) {
		lOCATION = location;
	}
	public int getRECURRING() {
		return rECURRING;
	}
	public void setRECURRING(int recurring) {
		rECURRING = recurring;
	}
	public Date getSTART_DATE() {
		return sTART_DATE;
	}
	public void setSTART_DATE(Date start_date) {
		sTART_DATE = start_date;
	}
	public Date getSTART_TIME() {
		return sTART_TIME;
	}
	public void setSTART_TIME(Date start_time) {
		sTART_TIME = start_time;
	}
	public String getTITLE() {
		return tITLE;
	}
	public void setTITLE(String title) {
		tITLE = title;
	}
	public int getTYPE() {
		return tYPE;
	}
	public void setTYPE(int type) {
		tYPE = type;
	}
	public int getUID() {
		return uID;
	}
	public void setUID(int uid) {
		uID = uid;
	}
	public int getWD() {
		return wD;
	}
	public void setWD(int wd) {
		wD = wd;
	}
	public int getWF() {
		return wF;
	}
	public void setWF(int wf) {
		wF = wf;
	}
	public int getWX() {
		return wX;
	}
	public void setWX(int wx) {
		wX = wx;
	}
	
	//Comparing based on times, not on dates!
	public int compareTo(Object arg0) {
		CalendarEvent other =(CalendarEvent)arg0;
		if(sTART_TIME==null){
			if(other.sTART_DATE!=null)
				return -1;
			return 0;
		}
		if(other.sTART_TIME==null)
			return 1;
		return this.sTART_TIME.compareTo(other.sTART_TIME);
	}
}
